/*
2021-7-23 
https://www.acwing.com/problem/content/3779/
*/
#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        int a,b,c,d,e,f;
        cin>>a>>b>>c>>d>>e>>f;
        
        if(e>f)
        {
            int x=min(a,d);
            int y=min({b,c,d-x});
            cout<<x*e+y*f<<endl;
        }
        else
        {
            int y=min({b,c,d});
            int x=min(a,d-y);
            cout<<x*e+y*f<<endl;
        }
        
    }
    return 0;
}


